package com.autonavi.yunda.yunji.controller.request;

import com.autonavi.yunda.yunji.core.model.dto.EngineHealthCheckDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;

/**
 * @author sunzhenbang
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class EngineHealthCheckRequest {
    private Long id;
    @NotNull
    private Long interfaceId;
    @NotNull
    private Integer open;
    private String checkData;
    private Integer checkTimeInterval;

    public EngineHealthCheckDTO toAddDTO(String operator) {
        return EngineHealthCheckDTO.builder().interfaceId(interfaceId).open(open).checkData(checkData).checkTimeInterval(checkTimeInterval)
                .createUser(operator).updateUser(operator).build();
    }

    public EngineHealthCheckDTO toUpdateDTO(String operator) {
        return EngineHealthCheckDTO.builder().id(id).open(open).checkData(checkData).checkTimeInterval(checkTimeInterval).updateUser(operator).build();
    }
}
